package com.abu.crms.pojo;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.Email;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * 普通用户表
 * </p>
 *
 * @author 阿布
 * @since 2021-03-08
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@TableName("cs_user")
@ApiModel(value = "User对象", description = "普通用户表")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "自增id")
    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    private Long userId;

    @ApiModelProperty(value = "用户名")
    private String username;

    @ApiModelProperty(value = "所在班级名的id")
    @JsonProperty("classId")
    private String classesId;

    @ApiModelProperty(value = "学号")
    private String cardNum;

    @ApiModelProperty(value = "第三方官方唯一编号信息")
    private String openId;

    @ApiModelProperty(value = "登录密码")
    @JsonProperty(value = "secondPassword")
    private String password;

    @JsonIgnore
    @ApiModelProperty(value = "盐值")
    private String salt;

    @Email(message = "邮箱格式不对")
    @ApiModelProperty(value = "邮箱")
    private String userEmail;

    @ApiModelProperty(value = "头像地址")
    private String img;

    @ApiModelProperty(value = "新用户是否已经通过邮箱激活帐号")
    @TableField(value = "is_active")
    private String active;

    @ApiModelProperty(value = "性别")
    private String userSex;

    @ApiModelProperty(value = "手机")
    private String userTel;

    @JsonFormat(pattern = "yyyy-MM-dd HH:mm")
    @ApiModelProperty(value = "创建时间")
    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime gmtCreate;

    @ApiModelProperty(value = "修改时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime gmtModified;

    @TableField("is_deleted")
    @TableLogic
    private Boolean deleted;


}
